import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 标记客户信息 */
export interface MyCustomer {
          id: number; // ID
          customerId: number; // 客户id
          username?: string; // 姓名
          sex: number; // 用户性别
          age: number; // 年龄
          quota: number; // 贷款额度
          mobile: string; // 手机号码
          remark: string; // 客户条件备注
          starRating: number; // 客户星级
          realestate: number; // 房产
          housingProvidentFund: number; // 公积金
          socialinsurance: number; // 社保
          followTime?: string | Dayjs; // 跟进时间
          followRemark: string; // 跟进备注
          followUpStatus: number; // 跟进状态
  }

// 标记客户 API
export const MyCustomerApi = {
  // 查询标记客户分页
  getMyCustomerPage: async (params: any) => {
    return await request.get({ url: `/system/my-customer/page`, params })
  },

  // 查询标记客户详情
  getMyCustomer: async (id: number) => {
    return await request.get({ url: `/system/my-customer/get?id=` + id })
  },

  // 新增标记客户
  createMyCustomer: async (data: MyCustomer) => {
    return await request.post({ url: `/system/my-customer/create`, data })
  },

  // 修改标记客户
  updateMyCustomer: async (data: MyCustomer) => {
    return await request.put({ url: `/system/my-customer/update`, data })
  },

  // 删除标记客户
  deleteMyCustomer: async (id: number) => {
    return await request.delete({ url: `/system/my-customer/delete?id=` + id })
  },

  /** 批量删除标记客户 */
  deleteMyCustomerList: async (ids: number[]) => {
    return await request.delete({ url: `/system/my-customer/delete-list?ids=${ids.join(',')}` })
  },

  // 导出标记客户 Excel
  exportMyCustomer: async (params) => {
    return await request.download({ url: `/system/my-customer/export-excel`, params })
  },

  /** 是否已标记 */
  getByCustomer: async (params) => {
    return await request.get({ url: `/system/my-customer/getByCustomer`, params })
  },

  /** 取消标记 */
  deletedByCustomer: async (params) => {
    return await request.get({ url: `/system/my-customer/deletedByCustomer`, params })
  },
}